const colors = new Set();
colors.add('pink');
colors.add('lightblue');
colors.add('cyan');
colors.add(1);
colors.add('2');
colors.add('2');
colors.delete('2');
// colors.clear();
const iterator = colors.values();
console.log(iterator.next());
console.log(iterator.next());
console.log(iterator.next());
console.log(iterator.next());
console.log(colors);
console.log('has:' + colors.has(1));
console.log('has:' + colors.has('2'));
for (const color of colors) {
    console.log(color);
}

colors.forEach((item, key, ownSet) => {
    console.log("item:" + item, ", key:" + key, ownSet);
})

const fruits = new Set(['apple', 'melon', 'peach']);
console.log(fruits);

const numbers = new Set([1, 2, 3, 4, 5, 4, 3, 2, 1])
console.log(numbers);
console.log([...numbers]);

console.log([...new Set('ababbc')].join(''));

// WeakSet
let jelly = { name: 'jelly', age: 15 };
let mary = { name: 'mary', age: 15 };
const students = new WeakSet([jelly, mary]);
console.log(students);